<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
/*
	应用选择
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'one';
$return=array();
	//会员列表
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$return['params']=$params=array('type <>'=>4);
	$fields=array('id','name','title','is_legao','image');
	if($_RQ['find']){
		$field=in_array($_RQ['field'],$fields)?$_RQ['field']:'title';
		$params[$field.' like']='%'.$_RQ['find'].'%';
		$return['params']['find']=$_RQ['find'];
		$return['params']['field']=$field;
	}
	$list=pdo_getslice('core_plugins',$params,array($pindex,$psize),$total,$fields,'','id desc');
	if($list){
		foreach($list as $k=>&$item){
			$install = check_permission($item['name']);
			if($install){
				if($_RQ['op']=='many'){
					$item['res']=array('name'=>$item['name'],'title'=>$item['title'],'image'=>$item['image']?$item['image']:'../core/resource/images/nopic.jpg');
				}else{
					$item['res']=$item['name'];
				}
			}else{
				unset($list[$k]);
			}
		}
	}
	$return['list']=$list;
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$return['htmls']=array(
		'type'=>'list',
		'tabs'=>array(
			array('op'=>'list','title'=>'应用列表'),
		),
		'list'=>array('data'=>'list','del_one'=>false,'delall'=>false,'edit'=>false,'list'=>array(
		    array('name'=>'name','title'=>'应用标识','type'=>'string'),
			array('name'=>'title','title'=>'应用名称','type'=>'string'),
			array('name'=>'image','title'=>'应用图片','type'=>'image'),
		),'action'=>array(
			array('type'=>'modal_result','name'=>'res','title_field'=>'title','title'=>'选取'),
		)),
		'search_one'=>array('name'=>'find','select_name'=>'field','select_title'=>'筛选','is_radio'=>true,'options'=>'fields'),
	);
	$return['fields']=array(
		'name'=>'应用标识',
		'title'=>'应用名称',
	);
	exi($return);

?>